﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Data;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.Sql;
using System.Data.SqlClient;
public class CustomUserDetailes
{
    public string id;
    public string UserName;
}
public partial class MasterPage : System.Web.UI.MasterPage
{
    public string getUserId(string Nume)
    {
        DataContext db = new DataContext("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\ASPNETDB.MDF;Integrated Security=True;User Instance=True;");
        Table<aspnet_User> aspnet_User = db.GetTable<aspnet_User>();
        IQueryable<CustomUserDetailes> userQuery = from p in aspnet_User
                                                   where p.UserName == Nume
                                                   select new CustomUserDetailes { id = p.UserId };
        //"Select * from profile where id = '" + id + "'";
        foreach (CustomUserDetailes i in userQuery)
        {
            return i.id;
        }
        return null;
    }
    public string getUserName(string vid)
    {
        DataContext db = new DataContext("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\ASPNETDB.MDF;Integrated Security=True;User Instance=True;");
        Table<aspnet_User> aspnet_User = db.GetTable<aspnet_User>();
        IQueryable<CustomUserDetailes> userQuery = from p in aspnet_User
                                                   where p.UserId == vid
                                                   select new CustomUserDetailes { UserName = p.UserName };
        //"Select * from profile where id = '" + id + "'";
        foreach (CustomUserDetailes i in userQuery)
        {
            return i.UserName;
        }
        return null;
    }
   
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
}
